/*******************************************************************************
 * This program and the accompanying materials
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * <p>
 * Contributors:
 * Peter Smith
 *******************************************************************************/
package com.ihr360.expr;


import com.ihr360.expr.core.Expr;
import com.ihr360.expr.core.ExprType;

import java.util.Date;

public class ExprDate extends Expr {
    public static final ExprDate EMPTY = new ExprDate(new Date());

    public final Date date;

    public ExprDate(Date date) {
        super(ExprType.Date, false);
        this.date = date;
    }

    public long longValue() {
        return date.getTime();
    }

    @Override
    public String toString() {
        return date.toString();
    }

    @Override
    public int hashCode() {
        return date.hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        return obj instanceof ExprDate && date.equals(((ExprDate) obj).date);
    }

}
